import {Injectable} from "@angular/core";

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs/Observable";
import {WebUrl} from "../../framework/interface/webUrl";
import { AjaxResponse } from "rxjs";



@Injectable()
export class SystemService {

    private headers = new HttpHeaders({'Content-Type':'multipart/form-data'});

    tempOptions = {withCredentials: true};
    private httpService:HttpClient;
    options: any;
    constructor(private http: HttpClient){
        this.options = { headers: this.headers, withCredentials: true };
    }
    // 网络接口请求

    getLoginInfo(data): Observable<Response> {
        return this.http.post<Response>(WebUrl.loginUrl, data, this.tempOptions);

    }
    getLoginInfoByPhone(data) : Observable<Response>{
        return this.http.post<Response>(WebUrl.loginByPhone,data,this.tempOptions);
    }
    //获取设置信息
    getSettingInfo():Observable<Response>{
        return this.http.get<any>(WebUrl.getSetingUrl,this.tempOptions);
    }
    //设置ip和端口
    getIpPortInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.loginSetingUrl,data,this.tempOptions);
    }

    //修改密码
    getUpdatePwd(data):Observable<Response>{
        return this.http.post<any>(WebUrl.updatePwdUrl,data,this.tempOptions);
    }
    //获取公告列表
    getNotifyList(data):Observable<Response>{
        return this.http.post<any>(WebUrl.notifyListUrl,data,this.tempOptions);
    }

    //获取公告详情
    getNotifyDetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.notifyDetailUrl,data,this.tempOptions);
    }
    //关于信息
    getAboutUs():Observable<Response>{
        return this.http.get<any>(WebUrl.AboutUsUrl,this.tempOptions);
    }
    //审批列表
    getCheckList(data):Observable<Response>{
        return this.http.post<any>(WebUrl.checkListUrl,data,this.tempOptions);
    }

    //审批详情
    getCheckDetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.checkDetailUrl,data,this.tempOptions);
    }
    //审批信息
    getCheckInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.checkInfoUrl,data,this.tempOptions);
    }
    //年度
    getYearsBudget():Observable<Response>{
        return this.http.get<any>(WebUrl.yearsBudgetUrl,this.tempOptions);
    }
    //获取系统消息
    getSysMsgUrl(data):Observable<Response>{
        return this.http.post<any>(WebUrl.sysMsgUrl,data,this.tempOptions);
    }
    //获取指标
    getProject(data):Observable<Response>{
        return this.http.post<any>(WebUrl.getProjectUrl,data,this.tempOptions);
    }

    //支出指南
    getPayGuideList(data):Observable<Response>{
        return this.http.post<Response>(WebUrl.payGuideListUrl,data,this.tempOptions);
    }

    //支出详情
    getPayGuideDetails(data):Observable<Response>{
        return this.http.post<Response>(WebUrl.payGuideDetailUrl,data,this.tempOptions);
    }

    //报销部门
    getBranchList(data):Observable<Response>{
        return this.http.post<any>(WebUrl.getDeptUrl,data,this.tempOptions);
    }

    //支出事项
    getPayItems(data):Observable<Response>{
        return this.http.post<any>(WebUrl.getPayItemsUrl,data,this.tempOptions);
    }
    //指标查询
    getIndexSelect(data):Observable<Response>
    {
        return this.http.post<any>(WebUrl.indexSelectUrl,data,this.tempOptions);
    }
    //执行申请单
    getRequestInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.requestInfoUrl,data,this.tempOptions);
    }
    //获取合同信息
    getContractInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.contractInfoUrl,data,this.tempOptions);
    }
    //报销支出明细
    getPayDetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.getPayDetailUrl,data,this.tempOptions)
    }
    //辅助信息
    getAssistInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.assistInfoUrl,data,this.tempOptions);
    }
    //结算信息
    getAccountInfo(data):Observable<Response>{
        return this.http.post<any>(WebUrl.accountInfoUrl,data,this.tempOptions);
    }
    //上传
    getFileUpload(data):Observable<Response>{
        return this.http.post<any>(WebUrl.fileUploadUrl,data,this.tempOptions);
    }
    //下载
    getFileDownLoad(data):Observable<Response>{
        return this.http.post<any>(WebUrl.fileDownLoadUrl,data,this.tempOptions);
    }
    //报销审核
    getApplyDetailUrl(data){
        return this.http.post<any>(WebUrl.applyDetailUrl,data,this.tempOptions);
    }
    //获取流程信息
    getFlowInfo(data){
        return this.http.post<any>(WebUrl.liuChenXXUrl,data,this.tempOptions);
    }
    //获取资金申请单信息
    getApplyMoneyInfo(data){
        return this.http.post<any>(WebUrl.applyMoneyDXXUrl,data,this.tempOptions);
    }
    getImgPlayList(){
        return this.http.get<any>(WebUrl.imgPlayListUrl,this.tempOptions);
    }
    //获取支出明细总计金额与费用信息标准值
    getDetailSumMoney(data){
        return this.http.post<any>(WebUrl.detailSumMoneyUrl,data,this.tempOptions);
    }
    getBaoXiaoType(){
        return this.http.get<any>(WebUrl.getBaoXiaoLXUrl,this.tempOptions);
    }
    //获取首页待办
    getToDoList(data):Observable<Response>{
      return this.http.post<any>(WebUrl.toDoUrl,data,this.tempOptions);
    }
    //获取我的报销
    getExpensesList(data):Observable<Response>{
      return this.http.post<any>(WebUrl.expensesUrl,data,this.tempOptions);
    }
    //获取待办审批
    getToDoApprova(data):Observable<Response>{
      return this.http.post<any>(WebUrl.toDoApprovalUrl,data,this.tempOptions);
    }
    //修改系统消息状态
    updateSysMsgState(data):Observable<Response>{
      return this.http.post<any>(WebUrl.updateSysMsgState,data,this.tempOptions);
    }
    //盘点保存
    panDianSave(data):Observable<Response>{
        return this.http.post<any>(WebUrl.panDianSaveUrl,data,this.tempOptions);
    }
    //盘点详情
    panDetialUrl(data):Observable<Response>{
        return this.http.post<any>(WebUrl.panDetialUrl,data,this.tempOptions);
    }
    //盘点列表
    panDianList(data):Observable<Response>{
        return this.http.post<any>(WebUrl.panDianListUrl,data,this.tempOptions);
    }
    panDianConfirm(data):Observable<Response>{
        return this.http.post<any>(WebUrl.panDianConfirm,data,this.tempOptions);
    }
    dbspzjDetails(data):Observable<Response>{
        return this.http.post<any>(WebUrl.zjsqdbspDetails,data,this.tempOptions);
    }
    dbspzxDetails(data):Observable<Response>{
        return this.http.post<any>(WebUrl.zxsqdbspDetails,data,this.tempOptions);
    }
    zxsqdbspApprove(data):Observable<Response>{
        return this.http.post<any>(WebUrl.zxsqdbspApprove,data,this.tempOptions);
    }
    zjsqdbspApprove(data):Observable<Response>{
        return this.http.post<any>(WebUrl.zjsqdbspApprove,data,this.tempOptions);
    }
    //配置文件设置
    settingProperties(data):Observable<Response>{
        return this.http.post<any>(WebUrl.settingPropertiesUrl,data,this.tempOptions);
    }
    //用户认证
    validate(data):Observable<Response>{
        return this.http.post<any>(WebUrl.validateUrl,data,this.tempOptions);
    }
    //审批详情(合同变更)
    htgldbspBgdetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.htgldbspBgdetail,data,this.tempOptions);
    }
    //审批(合同变更)
    htgldbspBgapprove(data):Observable<Response>{
        return this.http.post<any>(WebUrl.htgldbspBgapprove,data,this.tempOptions);
    }
    //审批详情(合同签订)
    htgldbspDetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.htgldbspDetail,data,this.tempOptions);
    }
    //审批(合同签订)
    htgldbspApprove(data):Observable<Response>{
        return this.http.post<any>(WebUrl.htgldbspApprove,data,this.tempOptions);
    }
    //审批详情(采购需求)
    cgxqdbspDetail(data):Observable<Response>{
        return this.http.post<any>(WebUrl.cgxqdbspDetail,data,this.tempOptions);
    }
    //审批(采购需求)
    cgxqdbspApprove(data):Observable<Response>{
        return this.http.post<any>(WebUrl.cgxqdbspApprove,data,this.tempOptions);
    }
    //发票验证
    FaPiaoYZService(data):Observable<Response>{
        return this.http.post<any>(WebUrl.faPiaoYZUrl,data,this.tempOptions);
    }
    //资产卡片详细信息
    ZiChanXiangXiXXService(data):Observable<Response>{
        return this.http.post<any>(WebUrl.ziChanXiangXiXXUrl,data,this.tempOptions);
    }
    //获取手机验证码
    verifyCodeService(data):Observable<Response>{
        return this.http.post<any>(WebUrl.verifyCodeUrl+"/"+data.phoneNumber,data,this.tempOptions);
    }
    getBackgroundImage():Observable<Response>{
       return this.http.get<any>(WebUrl.getBackgroundImageUrl);
    }
}
